package com.hessianmemcache.client;

import java.net.HttpURLConnection;
import java.net.URL;

import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.hessianmemcache.client.iface.IHello;
import com.hessianmemcache.client.iface.IMemcache;

public class StartUp
{
	public static FileSystemXmlApplicationContext context;

	public static void main(String[] args)
	{
		try
		{
//			URL url = new URL("http://192.168.1.113:8080/MemcacheManager/remoting/HessianMemcacheRemoting");
//            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//            connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
			
			String[] xml = new String[1];
			xml[0] = "WebRoot/WEB-INF/conf/remote-client.xml";

			context = new FileSystemXmlApplicationContext(xml);

//			IHello hello = (IHello) context.getBean("myServiceClient");
//			System.out.println(hello.sayHello());
			
			IMemcache memcache = (IMemcache) context.getBean("myServiceClient");
			//memcache.output("test2");
			//memcache.buildCache("test2", "win  192.168.1.10 a test too,zoomhoo!223");
			
			String valueString0 = memcache.hessian2Output("test10");
			System.out.println("test10="+valueString0);
			String valueString1 = memcache.hessian2Output("test135");
			System.out.println("test135="+valueString1);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}

	}
}
